home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / gdm / XKeepsCrashing < prev    next >
Encoding:
Text File  |  2006-10-20  |  3.9 KB  |  140 lines

  1. #!/bin/sh
  2.  
  3. if test "x$UNSAFE_TO_TRANSLATE" = "xyes" ; then
  4.   LANG=C
  5.   unset LC_ALL
  6.   unset LC_MESSAGES
  7. fi
  8.  
  9. if test -x "$LIBEXECDIR/gdmtranslate" ; then
  10.   GDMTRANSLATE="$LIBEXECDIR/gdmtranslate"
  11. else
  12.   GDMTRANSLATE=
  13. fi
  14.  
  15. gettextfunc () {
  16.   if test "x$GDMTRANSLATE" != "x" ; then
  17.     "$GDMTRANSLATE" "$1"
  18.   else
  19.     echo "$1"
  20.   fi
  21. }
  22.  
  23. OLD_IFS=$IFS
  24.  
  25. gdmwhich () {
  26.   COMMAND="$1"
  27.   OUTPUT=
  28.   IFS=:
  29.   for dir in $PATH
  30.   do
  31.     if test -x "$dir/$COMMAND" ; then
  32.       if test "x$OUTPUT" = "x" ; then
  33.         OUTPUT="$dir/$COMMAND"
  34.       fi
  35.     fi
  36.   done
  37.   IFS=$OLD_IFS
  38.   echo "$OUTPUT"
  39. }
  40.  
  41. # X has a bad habit of not restoring the vt settings on exit.  Make sure that
  42. # the keyboard is restored to xlate mode, since we're going to try to interact
  43. # with the user
  44. # (http://bugzilla.ubuntu.com/show_bug.cgi?id=6286)
  45. KBD_MODE=`gdmwhich kbd_mode`
  46. if test "x$KBD_MODE" != "x" ; then
  47.   kbd_mode -a
  48. fi
  49.  
  50. MSG3=`gettextfunc "Failed to start the X server (your graphical interface).  It is likely that it is not set up correctly.  You will need to log in on a console and reconfigure the X server.  Then restart GDM."`
  51. MSG4=`gettextfunc "Would you like to try to configure the X server?  Note that you will need the root password for this."`
  52. MSG5=`gettextfunc "Please type in the root (privileged user) password."`
  53. MSG6=`gettextfunc "Trying to restart the X server."`
  54. MSG7=`gettextfunc "The X server is now disabled.  Restart GDM when it is configured correctly."`
  55. MSG8=`gettextfunc "Failed to start the X server (your graphical interface).  It is likely that it is not set up correctly.  Would you like to view the X server output to diagnose the problem?"`
  56. MSG9=`gettextfunc "Would you like to view the detailed X server output as well?"`
  57.  
  58. # there are some env vars defined:
  59. # XLOG = the log file for the X server
  60. # BINDIR = location of gdm binaries
  61. # SBINDIR = location of gdm system binaries
  62. # LIBEXECDIR = location of gdm libexec binaries (gdmaskpass, gdmopen)
  63.  
  64. # return values are
  65. # 0 = try again, runs this server again
  66. # 1 = abort this display, removes this server from the list
  67. # 32 = something went very wrong, things will just get logged.
  68. #      this means this script didnt work so do alternative things
  69. #      to tell the user if possible
  70.  
  71. #
  72. # Now we check for dialog and gdmaskpass
  73. #
  74. DIALOG_OPTS=
  75. DIALOG=`gdmwhich dialog`
  76. if test "x$DIALOG" = "x" ; then
  77.   DIALOG=`gdmwhich whiptail`
  78.   DIALOG_OPTS="--scrolltext"
  79. fi
  80. if test -x "$LIBEXECDIR/gdmaskpass" ; then
  81.   ASKPASS="$LIBEXECDIR/gdmaskpass"
  82. else
  83.   ASKPASS=
  84. fi
  85.  
  86. # we require 'gdmopen', to open a console, because we really dont
  87. # have one.  Perhaps someone should try to figure out some shell
  88. # black magic to get this to work on other then linux systems
  89. if test ! -x "$LIBEXECDIR/gdmopen" ; then
  90.   exit 32
  91. fi
  92.  
  93. # when we run ourselves from the open we will pass a -noopen argument
  94. if test "x$1" = "x-noopen" ; then
  95.   shift
  96. else
  97.   #
  98.   # We do a lot of work wastefully over again, but oh well,
  99.   # perhaps this needs fixing.
  100.   #
  101.   "$LIBEXECDIR/gdmopen" -l /bin/sh -c "$0 -noopen $@"
  102.   exit $?
  103. fi
  104.  
  105. clear
  106.  
  107. # Note, dialog required, though this script could be fixed to not require it
  108. # I suppose
  109. if test "x" = "x$DIALOG" ; then
  110.   echo =======================================================================
  111.   echo 
  112.   cat "$XLOG"
  113.   echo 
  114.   echo =======================================================================
  115.   echo
  116.   if test -x /usr/bin/fmt ; then
  117.     echo  "$MSG3" | /usr/bin/fmt
  118.   else
  119.     echo  "$MSG3"
  120.   fi
  121.   echo
  122.   echo =======================================================================
  123.   read
  124.   exit 1
  125. fi
  126.  
  127. if "$DIALOG" --yesno "$MSG8" 10 50 ; then 
  128.   "$DIALOG" $DIALOG_OPTS --textbox "$XLOG" 22 76
  129.   # Support XFree86 v4 logfile thingie
  130.   if grep '^(..) Log file: "' "$XLOG" 2> /dev/null ; then
  131.     XLOG_DETAIL=`grep '^(..) Log file: "' "$XLOG" | sed 's/^[^"]*"\([^"]*\)".*$/\1/'`
  132.     if "$DIALOG" --yesno "$MSG9" 10 50 ; then 
  133.       "$DIALOG" $DIALOG_OPTS --textbox "$XLOG_DETAIL" 22 76
  134.     fi
  135.   fi
  136. fi
  137.  
  138. "$DIALOG" --msgbox "$MSG7" 8 50
  139. exit 1
  140.